﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SEAM.Data
{
    /// <summary>
    /// Attribute that can be associated with member variables or properties
    /// of a given object.  The attribute is used to identify fields that data
    /// can be bound to when using DataAccess.
    /// 
    /// <example>
    /// public class MyObject
    /// {
    ///     [Bind("ObjectID")]
    ///     private int ID;
    ///     
    ///     private string name;
    ///     
    ///     [Bind("ObjectName")
    ///     public string Name
    ///     {
    ///         get { return name; }
    ///         set { name = value; }
    ///     }
    ///     
    ///     //...
    /// }
    /// </example>
    /// 
    /// </summary>
    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
    public class BindAttribute : Attribute
    {
        private string _name;

        /// <summary>
        /// Name of the Bind attribute.
        /// </summary>
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        /// <summary>
        /// Creates an instance of the BindAttribute
        /// </summary>
        /// <param name="name">Name of the attribute</param>
        public BindAttribute(string name)
        {
            Name = name;
        }
    }
}
